  function checkForm(form)
  {
    if(form.j_username.value == "") {
    	alert("Error: Username cannot be blank!");
    	form.j_username.focus();
    	return false;
    }
    re = /^\w+$/;
    if(!re.test(form.j_username.value)) {
    	alert("Error: Username must contain only letters, numbers and underscores.");
    	form.j_username.focus();
    	return false;
    }
    
    if(form.j_name.value == "") {
    	 alert("Error: First name cannot be blank.");
        form.j_name.focus();
        return false;
      }
    
      re = /^\w+$/;
      if(!re.test(form.j_name.value)) {
         alert("Error: First name must contain only letters.");
        form.j_name.focus();
        return false;
      }
      
    if(form.l_name.value == "") {
    	 alert("Error: Last name cannot be blank.");
      form.l_name.focus();
      return false;
    }
    
    re = /^\w+$/;
    if(!re.test(form.l_name.value)) {
    	 alert("Error: Last name must contain only letters.");
      form.l_name.focus();
      return false;
    }
    
    var pattern =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    if(!pattern.test(form.j_email.value)) {
    	 alert("Error: Email Address is not the correct format.");
    	form.j_email.focus();
    	return false;
    }
    
    if(form.j_password.value == "" || form.j_password2.value == "") {
    	alert("Error: Password fields cannot be blank.");
  	  	return false;
    }
    
    if(form.j_password.value != form.j_password2.value) {
    	alert("Error: Passwords do not match.");
  	  	return false;
    }

    if(form.j_password.value.length < 6) {
    	alert("Error: Password must contain at least six characters!");
    	form.j_password.focus();
    	return false;
    }
  
    if(form.j_password.value == form.j_username.value) {
	   alert("Error: Password must be different from Username!");
	   form.j_password.focus();
	   return false;
    }
      
    re = /[0-9]/;
    if(!re.test(form.j_password.value)) {
	   alert("Error: Password must contain at least one number (0-9)!");
	   form.j_password.focus();
	   return false;
    }

    re = /[a-z]/;
    if(!re.test(form.j_password.value)) {
	   alert("Error: Password must contain at least one lowercase letter (a-z)!");
	   form.j_password.focus();
	   return false;
    }
    
    re = /[A-Z]/;
    if(!re.test(form.j_password.value)) {
	  alert("Error: Password must contain at least one uppercase letter (A-Z)!");
	  form.j_password.focus();
	  return false;
    }
  
    return true;
}